Public: Technology Reviews : Removing Antialiasing
This page last changed on Oct 09, 2006 by scytacki.
Here is the original image: Edge detection can be used to remove the antialiasing. The netpbm package provides commands for edge detection. Here is the output of: ppmtopgm fish-demo.ppm > fish-demo.pgm pgmedge fish-demo.pgm > fish-demo-edge.pgm If that edge image is turned into a black and white image using thresholding with: pgmtopbm -threshold -value 0.1 fish-demo-edge.pgm > fish-demo-edge-0.1.pbm Then it can used as a mask to remove the antialiasing pixels. In this case all the antialiasing can be replaced with black pixels. That is because all the edges in the image have black outlines. Simply using black for all the pixels will make the black lines become thicker than in the original image.
Here is the result. If you look closely it has no antialias. Advanced antialiasing removalIf the image does not have black outlines around the colors, then simply replacing the antialiasing pixels with black will not work. Un - Weighted approachA simple approach would be to look at a window of 8 (3^2 - 1), 24 (5^2 - 1), or 48(7^2 - 1) neighbors for each antialiasing pixel, make a list of all the colors of the non antialiasing neighboors and choose the closest one to color of the current pixel. Potential problems with this approachThe problem with the un weighted approach is that there might be several colors within the window, and those colors might actually be "closer" to the antialiasing pixel. This would result in color speckles. To give an example look at what happens when the fish image is quantized with its actual palette:
In this particular case this wouldn't be a problem, because the orange area is so far away from the teeth. But you could imagine the orange area being within 5 pixels from the tooth and then this problem would ocur using the un-weighted technique. Weighted approachWith a weighted approach both the color distance and the pixel distance would be taken into account. And each would be given a weight perhaps a non-linear weight. Therefore if the balck and yellow pixels of the tooth are closer than the orange pixels they would be given a higher score even if their colors were futher than the orange. ClusteringIn general it seems like a color clustering algorithm would beable to remove the antialiasing appropriately, without needing the edge detection. If a palette is given as input to this clustering algorithm it should be fine. The key part of this clustering algorithm is that is based on location and color. Most quantizing and posterizing algorithms only look at the color histogram and don't take into account the location of the pixel. Perhaps this one would work:
fish-demo-edge-gray.png (image/png)
fish-demo-aliased.png (image/png) fish-demo.png (image/png) fish-tooth-scale_4.png (image/png) fish-tooth-quant_palette-scale_4.png (image/png) |
Document generated by Confluence on Jan 27, 2014 16:56 |